$(function() {
	$('#loginsubmit').bind('click',function() {
		$.post('ajax/login.php',{lc: $('#logincode').val()}, function(d){
			if(d == 1) {
				var content = $('#content');
				$('#login span.err').empty();
				content.slideUp('slow',function() {
					content.load('ajax/home.php',function(data){
						content.empty().html(data);
						content.css('height','auto');
						content.slideDown('slow');
					})
				});
			} else {
				$('#login span.err').text('Login Failed');
			}
		});
	});
	$("#logincode").keyup(function(e){
	    if(e.keyCode == 13){
		    $(this).blur(); //prevent multiple triggers by mashing the key
	        $("#loginsubmit").click()
	    }
	});
});